package com.hsylient.javase.chapter02.practice.demo02.version02;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IdCardExtractor extends Extractor {
    @Override
    public String checkPattern(String resource) {
        Pattern pattern = Pattern.compile("\\d{17}[\\d|x]|\\d{15}");
        Matcher matcher = pattern.matcher(resource);
        if (matcher.matches()) {
            return resource;
        }
        return null;
    }
}
